package com.hooper.apibackend.controller;

import com.hooper.util.RandomUtil;
import org.springframework.web.bind.annotation.*;

/**
 * @author Tim Hooper
 * @version 1.0
 * @time 2023/04/12/9:37
 */
@RestController
@RequestMapping("/api")
public class ProvideController {

    @GetMapping("/name")
    public String name() {
        return RandomUtil.randomCnName();
    }

    @GetMapping("/addr")
    public String addr() {
        return RandomUtil.randomAddress();
    }

    @PostMapping("/phone")
    public String phone(@RequestBody String prefix) {
        return prefix + RandomUtil.randomPhoneNum();
    }

    @PostMapping("/date")
    public String ranDatePost(@RequestBody Integer start) {
        return RandomUtil.randomStrDatetime(start);
    }

    @GetMapping("/date")
    public String ranDate(@RequestParam Integer start) {
        return RandomUtil.randomStrDatetime(start);
    }
}
